package net.wofly.sale.commission.service.impl;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import net.wofly.sale.commission.repository.SaleCommissionSumRepository;
import net.wofly.sale.commission.domain.SaleCommissionSum;
import net.wofly.sale.commission.service.ISaleCommissionSumService;

@Service("iSaleCommissionSumService")
@Transactional
public class SaleCommissionSumServiceImpl implements ISaleCommissionSumService {

	@Autowired
	SaleCommissionSumRepository saleCommissionSumRepository;

	@Override
	public SaleCommissionSum save(SaleCommissionSum entity) {
		return saleCommissionSumRepository.save(entity);
	}

	@Override
	public void delete(SaleCommissionSum entity) {
		saleCommissionSumRepository.delete(entity);
	}

	@Override
	public void delete(String key) {
		saleCommissionSumRepository.delete(key);
	}

	@Override
	public SaleCommissionSum findOne(String key) {
		return saleCommissionSumRepository.findOne(key);
	}

	@Override
	public List<SaleCommissionSum> save(List<SaleCommissionSum> entityList) {
		return (List<SaleCommissionSum>) saleCommissionSumRepository.save(entityList);
	}

	@Override
	public List<SaleCommissionSum> findBySumTimeAndSumDuration(Long sumTime, Integer sumDuration) {
		return saleCommissionSumRepository.findBySumTimeAndSumDurationOrderByModifyDateDesc(sumTime, sumDuration);
	}
}
